<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('Approve')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse" style="display: none">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>名称：</label>
                            <input type="text" name="requestName"/>
                        </li>
                        <li>
                            <label>创建者：</label>
                            <input type="text" name="requester"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-warning" onclick="$.table.exportExcel()">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var approveFlag = [[${@permission.hasPermi('system:approve:view')}]];
    var requestStatusDatas = [[${@dict.getType('sys_request_status')}]];
    var prefix = ctx + "system/approve";
    var prefix2 = ctx + "system/request";

    $(function() {
        var options = {
            url: prefix + "/list",
            aprUrl: prefix + "/apr/{id}",
            detailUrl: prefix + "/detail/{id}",
            modalName: "Approve",
            pagination: false,
            columns: [{
                checkbox: true
            },
                {
                    field: 'requestId',
                    title: '主键',
                    visible: false
                },
                {
                    field: 'requestName',
                    title: '服务请求名称',
                    formatter: function (value, row, index) {
                        return '<a href="javascript:void(0)" onclick="$.operate.detailTab2(\'' + row.requestId + '\')">'+value+'</a>';
                    }
                },
                {
                    field: 'description',
                    title: '描述',
                    visible: false
                },
                {
                    field: 'requestStatus',
                    title: '状态',
                    visible: false,
                    sortable: true,
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(requestStatusDatas, value);
                    }
                },
                {
                    field: 'createTime',
                    title: '时间',
                    visible: false
                },
                {
                    field: 'userReq.userName',
                    title: '创建者'
                },
                {
                    field: '',
                    title: 'Details',
                    formatter: function(value, row, index) {

                    }
                },
                {
                    field: 'result',
                    title: '结果路径',
                    visible: false
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + approveFlag + '" href="javascript:void(0)" onclick="$.operate.apr(\'' + row.requestId + '\')"><i class="fa fa-edit"></i>Approve</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>